home *** CD-ROM | disk | FTP | other *** search
/ Champak 109 / Vol 109.iso / games / free_sty.swf / scripts / DefineSprite_164 / frame_146 / DoAction.as
Text File  |  2008-11-12  |  873b  |  30 lines

  1. this.fu_mc.onEnterFrame = function()
  2. {
  3.    this.vv = 20;
  4.    this.mxx = _root.bg_mc.man._x;
  5.    this.myy = _root.bg_mc.man._y;
  6.    this.bxx = _root.zhu_array[_root.level][this._parent.upn][0];
  7.    this.byy = _root.zhu_array[_root.level][this._parent.upn][1];
  8.    if(this._parent._currentframe >= 148)
  9.    {
  10.       this._parent.stop();
  11.    }
  12.    else
  13.    {
  14.       this._parent.play();
  15.    }
  16.    if((this.mxx - this.bxx) * (this.mxx - this.bxx) + (this.myy - this.byy) * (this.myy - this.byy) > this.vv * this.vv)
  17.    {
  18.       var _loc3_ = Math.atan2(this.byy - this.myy,this.bxx - this.mxx);
  19.       this._parent._x += this.vv * Math.cos(_loc3_);
  20.       this._parent._y += this.vv * Math.sin(_loc3_);
  21.    }
  22.    else
  23.    {
  24.       this._parent._x = this.bxx;
  25.       this._parent._y = this.byy;
  26.       this._parent.gotoAndPlay(148);
  27.       delete this.onEnterFrame;
  28.    }
  29. };
  30.